﻿Public Class RperfilOpciones

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal pPerfilOpciones As EperfilOpciones) As List(Of EperfilOpciones)
        Dim perfilOpciones As List(Of EperfilOpciones) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                perfilOpciones = DperfilOpciones.SeleccionarTodo(descEmpresa, pPerfilOpciones)
                If perfilOpciones Is Nothing Then perfilOpciones = New List(Of EperfilOpciones)
                If DisplaySelect Then perfilOpciones.Insert(0, New EperfilOpciones("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return perfilOpciones
    End Function
    Public Shared Function SeleccionarTodos(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal pPerfilOpciones As EperfilOpciones) As List(Of EperfilOpciones)
        Dim perfilOpciones As List(Of EperfilOpciones) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                perfilOpciones = DperfilOpciones.SeleccionarTodos(descEmpresa, pPerfilOpciones)
                If perfilOpciones Is Nothing Then perfilOpciones = New List(Of EperfilOpciones)
                If DisplaySelect Then perfilOpciones.Insert(0, New EperfilOpciones("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return perfilOpciones
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal pOpciones As EperfilOpciones) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DperfilOpciones.Añadir(descEmpresa, pOpciones)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function EliminarAll(ByVal descEmpresa As String, ByVal pOpciones As EperfilOpciones) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DperfilOpciones.EliminarAll(descEmpresa, pOpciones)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Eliminar(ByVal descEmpresa As String, ByVal pOpciones As EperfilOpciones) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DperfilOpciones.Eliminar(descEmpresa, pOpciones)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class

